$(function() {
	var msgTitle = getLanMsg("0ec22400-000001");
	var msgProdPrice = getLanMsg("0ec22400-000002");
	var msgBiddingProj = getLanMsg("0ec22400-000003");
	var msgBadProj = getLanMsg("0ec22400-000004");
	var msgInvalidSupForZhaobiaoBid = "核准不合格与核准无扩展信息的供应商不允许参加招投标!";
	var prodPriceUrl = "javascript:showCfmMsg('" + msgTitle + "','"
			+ msgProdPrice + "')";
	var biddingProjUrl = "javascript:showCfmMsg('" + msgTitle + "','"
			+ msgBiddingProj + "')";
	var badProjUrl = "javascript:showCfmMsg('" + msgTitle + "','" + msgBadProj
			+ "')";
	// if (isEcSupp == "true" || isEcSupp == true) {
	prodPriceUrl = "/ebvp/prodprice/prodpricelist?menuid=47";
	biddingProjUrl = "/ebvp/sourcing/biddingprojlist?menuid=21";
	badProjUrl = "/ebvp/sourcing/badeprojlist?menuid=22";
	// }
	// 如果不是能够进行招投标的供应商
	// by zhangjxf 2014-05-19 20:03:00    BUG:NCdp205043086
	if(!isValidSupForZhaobiaoBid) {
		biddingProjUrl = "javascript:showCfmMsg('" + msgTitle + "','" + msgInvalidSupForZhaobiaoBid + "')";
		badProjUrl = "javascript:showCfmMsg('" + msgTitle + "','" + msgInvalidSupForZhaobiaoBid + "')";
	}
	var msg1 = getLanMsg("0ec22400-000006");
	var msg2 = getLanMsg("0ec22400-000007");
	var msg3 = getLanMsg("0ec22400-000008");
	var msg4 = getLanMsg("0ec22400-000009");
	var msg5 = getLanMsg("0ec22400-000010");
	var msg6 = getLanMsg("0ec22400-000011");
	var msg7 = getLanMsg("0ec22400-000012");
	var msg8 = getLanMsg("0ec22400-000013");
	var msg9 = getLanMsg("0ec22400-000014");
	var msg10 = getLanMsg("0ec22400-000015");
	var msg11 = getLanMsg("0ec22400-000016");
	var msg12 = getLanMsg("0ec22400-000017");
	var msg13 = getLanMsg("0ec22400-000018");
	var msg14 = getLanMsg("0ec22400-000019");
	var msg15 = getLanMsg("0ec22400-000020");
	var msg16 = getLanMsg("0ec22400-000021");
	var msg17 = getLanMsg("0ec22400-000022");
	var msg18 = getLanMsg("0ec22400-000023");
	var msg19 = getLanMsg("0ec22400-000024");
	var msg20 = getLanMsg("0ec22400-000025");
	var msg21 = getLanMsg("0ec22400-000026");
	var msg22 = getLanMsg("0ec22400-000027");
	var msg23 = getLanMsg("0ec22400-000028");
	var msg24 = getLanMsg("0ec22400-000029");
	var msg25 = getLanMsg("0ec22400-000030");
	var msg26 = getLanMsg("0ec22400-000031");
	var msg27 = getLanMsg("0ec22400-000032");
	var msg28 = getLanMsg("0ec22400-000033");
	var msg29 = getLanMsg("0ec22400-000034");
	var msg30 = getLanMsg("0ec22400-000035");
	var msg31 = getLanMsg("0ec22400-000036");
	var msg32 = getLanMsg("0ec22400-000037");
	var msg33 = getLanMsg("0ec22400-000038");
	var msg34 = getLanMsg("0ec22400-000039");
	var msg35 = getLanMsg("0ec22400-000188");
	var msg36 = getLanMsg("0ec22400-000189");
	var msg37 = getLanMsg("0ec22400-000190");
	var msg38 = getLanMsg("0ec22400-000191");
	var msg39 = getLanMsg("0ec22400-000192");
	var msg40 = getLanMsg("投诉与建议");
	var msg41 = getLanMsg("投诉响应");
	var msg42 = getLanMsg("建议响应");

	var selfServiceGh = [
			{
				'itemId' : "menuItem0",
				'itemName' : msg1,
				'needShow' : true,
				"itemUrl" : ".",
				'callback' : function() {
					window
							.open("https://chinajvs.towngas.com.cn/iisadmpwd/aexp2b.asp");
					return false;
				}
			}, {
				'itemId' : "menuItem1",
				'itemName' : msg2,
				'needShow' : bModuleSRM,
				"itemUrl" : "/ebvp/selfinfo/userinfo?menuid=42"
			}, {
				'itemId' : "menuItem2",
				'itemName' : msg3,
				'needShow' : bModuleSRM,
				"itemUrl" : "/ebvp/selfinfo/editinfo?menuid=43"
			}, {
				'itemId' : "menuItem3",
				'itemName' : msg4,
				'needShow' : bModuleSRM,
				"itemUrl" : "/ebvp/selfinfo/contractlist?menuid=46"
			}, {
				'itemId' : "menuItem4",
				'itemName' : msg5,
				'needShow' : bModuleEBP,
				"itemUrl" : prodPriceUrl
			}, {
				'itemId' : "menuItem5",
				'itemName' : msg6,
				'needShow' : bModuleEBP,
				"itemUrl" : "/ebvp/infopub/viewfile?menuid=48"
			} ];
	var selfServiceStd = [ {
		'itemId' : "menuItem0",
		'itemName' : msg1,
		'needShow' : true,
		"itemUrl" : "/ebvp/selfinfo/password?menuid=41"
	}, {
		'itemId' : "menuItem1",
		'itemName' : msg2,
		'needShow' : bModuleSRM,
		"itemUrl" : "/ebvp/selfinfo/userinfo?menuid=42"
	}, {
		'itemId' : "menuItem2",
		'itemName' : msg3,
		'needShow' : bModuleSRM,
		"itemUrl" : "/ebvp/selfinfo/editinfo?menuid=43"
	}, {
		'itemId' : "menuItem3",
		'itemName' : msg4,
		'needShow' : bModuleSRM,
		"itemUrl" : "/ebvp/selfinfo/contractlist?menuid=46"
	}, {
		'itemId' : "menuItem4",
		'itemName' : msg5,
		'needShow' : bModuleEBP,
		"itemUrl" : prodPriceUrl
	}, {
		'itemId' : "menuItem5",
		'itemName' : msg6,
		'needShow' : bModuleEBP,
		"itemUrl" : "/ebvp/infopub/viewfile?menuid=48"
	} ];
	if (bStdVersion) {
		$("#selfService").UIDropMenu( {
			"menuId" : "selfServiceMenu",
			'items' : selfServiceStd,
			'alignRight' : true
		});
	} else {
		$("#selfService").UIDropMenu( {
			"menuId" : "selfServiceMenu",
			'items' : selfServiceGh,
			'alignRight' : true
		});
	}

	var signedIn = [ {
		'itemId' : "nav0",
		'itemName' : msg7,
		'needShow' : "true",
		'itemUrl' : "/ebvp/infopub/pubmain"
	}, {
		'itemId' : "nav1",
		'itemName' : msg8,
		'needShow' : bModuleEBP,
		'itemUrl' : ".",
		'callback' : function() {
			return false;
		},
		'subMenu' : [ {
			'itemId' : "nav1menuItem0",
			'itemName' : msg9,
			'needShow' : bModuleEBP,
			"itemUrl" : biddingProjUrl
		}, {
			'itemId' : "nav1menuItem1",
			'itemName' : msg10,
			'needShow' : bModuleEBP,
			"itemUrl" : badProjUrl
		} ]
	}, {
		'itemId' : "nav2",
		'itemName' : msg11,
		'itemUrl' : ".",
		'needShow' : bModuleEBPOrSCM_CT && !bIsEsbSys,
		'subMenu' : [ {
			'itemId' : "nav2menuItem0",
			'itemName' : msg12,
			'needShow' : bModuleEBPOrSCM_CT && bStdVersion,
			"itemUrl" : "/ebvp/contract/contractconfirm?menuid=38"
		}, {
			'itemId' : "nav2menuItem1",
			'itemName' : msg13,
			'needShow' : bModuleEBPOrSCM_CT,
			"itemUrl" : "/ebvp/contract/contractlist?menuid=34"
		}, {
			'itemId' : "nav2menuItem2",
			'itemName' : msg14,
			'needShow' : bModuleEBP && bStdVersion,
			"itemUrl" : "/ebvp/contractprice/ctreptlist?menuid=35"
		}, {
			'itemId' : "nav2menuItem3",
			'itemName' : msg35,
			'needShow' : bModuleEBP && bModuleSCM_CT,
			"itemUrl" : "/ebvp/contract/initCtPriceAd"
		}, {
			'itemId' : "nav2menuItem4",
			'itemName' : msg36,
			'needShow' : bModuleEBP && bModuleSCM_CT,
			"itemUrl" : "/ebvp/contract/initCtPrice"
		} ],
		'callback' : function() {
			return false;
		}
	}, {
		'itemId' : "nav3",
		'itemName' : msg15,
		'needShow' : bModuleEBPOrSCM_PU && !bIsEsbSys,
		'itemUrl' : ".",
		'subMenu' : [ {
			'itemId' : "nav3menuItem0",
			'itemName' : msg16,
			'needShow' : bModuleEBPOrSCM_PU,
			"itemUrl" : "/ebvp/order/confirmlist?menuid=31"
		}, {
			'itemId' : "nav3menuItem1",
			'itemName' : msg17,
			'needShow' : bModuleSCM_PU && bStdVersion,
			"itemUrl" : "/ebvp/order/exestatuslist?menuid=32"
		}, {
			'itemId' : "nav3menuItem2",
			'itemName' : msg18,
			'needShow' : bModuleSCM_PU,
			"itemUrl" : "/ebvp/order/exeinfolist?menuid=33"
		} ],
		'callback' : function() {
			return false;
		}
	}, {
		'itemId' : "nav4",
		'itemName' : msg19,
		'needShow' : bModuleEBVSCOrSCM_PU,
		'itemUrl' : ".",
		'subMenu' : [ {
			'itemId' : "nav4menuItem0",
			'itemName' : msg20,
			'needShow' : bModuleSCM_PU,
			"itemUrl" : "/ebvp/other/goQryPageFromList?menuid=36"
		}, {
			'itemId' : "nav4menuItem1",
			'itemName' : msg22,
			'needShow' : bModuleSCM_PU,
			"itemUrl" : "/ebvp/other/sendNoticeList"
		}, {
			'itemId' : "nav4menuItem2",
			'itemName' : msg21,
			'needShow' : bModuleSCM_PU,
			"itemUrl" : "/ebvp/other/sendPlanList?menuid=37"
		}, {
			'itemId' : "nav4menuItem3",
			'itemName' : msg23,
			'needShow' : bModuleEBVSC,
			"itemUrl" : "/ebvp/schedulecoll/paichengconller/scheduleconfirm"
		}, {
			'itemId' : "nav4menuItem4",
			'itemName' : msg37,
			'needShow' : bModuleEBVSC,
			"itemUrl" : "/ebvp/schedulecoll/scheduleDetail"
		}, {
			'itemId' : "nav4menuItem5",
			'itemName' : msg38,
			'needShow' : bModuleEBVSC,
			"itemUrl" : "/ebvp/schedulecoll/scheHisProdCount"
		}, {
			'itemId' : "nav4menuItem6",
			'itemName' : msg39,
			'needShow' : bModuleEBVSC,
			"itemUrl" : "/ebvp/schedulecoll/scheHistoryDetail"
		} ],
		'callback' : function() {
			return false;
		}
	}, {
		'itemId' : "nav5",
		'itemName' : msg24,
		'needShow' : bModuleSCM_IC,
		'itemUrl' : ".",
		'subMenu' : [ {
			'itemId' : "nav5menuItem0",
			'itemName' : msg25,
			'needShow' : bModuleSCM_IC_SYS,
			"itemUrl" : "/ebvp/other/nowStorageList"
		}, {
			'itemId' : "nav5menuItem1",
			'itemName' : msg26,
			'needShow' : bModuleSCM_PU && bModuleSCM_IC_EBP_SYS && bStdVersion,
			"itemUrl" : "/ebvp/other/addGoodsApplyList"
		}, {
			'itemId' : "nav5menuItem2",
			'itemName' : msg27,
			'needShow' : bModuleSCM_IC_SYS,
			"itemUrl" : "/ebvp/other/useCountList"
		}, {
			'itemId' : "nav5menuItem3",
			'itemName' : msg28,
			'needShow' : bModuleSCM_IC,
			"itemUrl" : "/ebvp/other/arrGoodsList?menuid=52"
		}, {
			'itemId' : "nav5menuItem4",
			'itemName' : msg29,
			'needShow' : bModuleSCM_IC,
			"itemUrl" : "/ebvp/other/storageList?menuid=53"
		}, {
			'itemId' : "nav5menuItem5",
			'itemName' : msg30,
			'needShow' : bModuleSCM_IC,
			"itemUrl" : "/ebvp/other/supInfoList?menuid=51"
		}, {
			'itemId' : "nav5menuItem6",
			'itemName' : msg31,
			'needShow' : bModuleSCM_IC_SYS,
			"itemUrl" : "/ebvp/other/backGoodsHandlerList"
		} ],
		'callback' : function() {
			return false;
		}
	}, {
		'itemId' : "nav6",
		'itemName' : msg32,
		'needShow' : bModuleARAPOrSCM_PU,
		'itemUrl' : ".",
		'subMenu' : [ {
			'itemId' : "nav6menuItem0",
			'itemName' : msg33,
			'needShow' : bModuleSCM_PU,
			"itemUrl" : "/ebvp/other/invoiceList?menuid=54"
		}, {
			'itemId' : "nav6menuItem1",
			'itemName' : msg34,
			'needShow' : bModuleARAP && bStdVersion,
			"itemUrl" : "/ebvp/other/paymentList?menuid=55"
		} ],
		'callback' : function() {
			return false;
		}
	}, {
		'itemId' : "nav7",
		'itemName' : msg40,
		'needShow' : bModuleARAPOrSCM_PU,
		'itemUrl' : ".",
		'subMenu' : [ {
			'itemId' : "nav7menuItem0",
			'itemName' : msg41,
			'needShow' : bModuleSCM_PU,
			"itemUrl" : "/ebvp/advorappcoll/appealrespcompl?complainoradvis=1"
		}, {
			'itemId' : "nav7menuItem1",
			'itemName' : msg42,
			'needShow' : bModuleSCM_PU,
			"itemUrl" : "/ebvp/advorappcoll/appealrespcompl?complainoradvis=0"
		} ],
		'callback' : function() {
			return false;
		}
	} ];
	/* 导航栏及下拉菜单 */
	$("#signedInNavigatorBar").UINavigator( {
		'items' : signedIn
	});
	/* 给所有的form_title 的元素 增加title */
	/* 门户目前不需要，故去掉，by mawl */
	// $(".form_title").each(function() {
	// $(this).attr("title", $(this).text());
	// });
	// 设置导航菜单状态。
	var config = {
		// 首页
		"nav0" : [ "pubmain", "infopub" ],
		// 投标
		"nav1" : [ "sourcing" ],
		// 合同
		"nav2" : [ "contract" ],
		// 订单
		"nav3" : [ "order" ],
		// 发货排程
		"nav4" : [ "goQryPageFromList", "sendNoticeList", "qrySendNotice",
				"qrySendNoticeDetail", "exportSendNotice", "goToAddPage",
				"goQryPageFromList", "goQryPageFromAdd", "addQryData2NewPage",
				"saveMySendPlan", "deleteSendNotice", "cmtMySendPlan",
				"goback2AddPage", "goback2List", "goBack2SenNoticeList",
				"sendPlanList", "qrySendPlan", "sendPlanSave",
				"exportSendPlan", "schedulecoll" ],
		// 库存不用配置，不配置的全部为库存
		// 结算
		"nav6" : [ "invoiceList", "qryInvoiceList", "exportInvoice",
				"invoiceDetail", "goBack2Invoice", "paymentList",
				"qryPaymentList", "exportPayment", "paymentDetail",
				"goBack2Payment" ],
		// 投诉与建议
		"nav7" : [ "appealrespcompl", "advicerespsugg" ]

	};
	// 根据url来判断是哪个模块
	var url = window.location.href;
	var hit = false;
	for ( var module in config) {
		var pages = config[module];
		for ( var i = 0; i < pages.length; i++) {
			if (url.indexOf(pages[i]) != -1) {
				$("#" + module).addClass("focus");
				hit = true;
				return;
			}
		}
	}
	// 如果不在配置中则全部为【库存】nav5
	// if (!hit) {
	// $("#nav5").addClass("focus");
	// }
});